package com.example.llh.zyfypt_110llh.fragment.MySave;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.llh.zyfypt_110llh.R;
import com.example.llh.zyfypt_110llh.activity.MyCollectActivity;
import com.example.llh.zyfypt_110llh.activity.MyFollowActivity;
import com.example.llh.zyfypt_110llh.bean.log.SessionIDBean;

public class MyFragment extends Fragment {
    private View view=null;
    private Context context;
    private SessionIDBean sessionIDBean;
    private TextView realName;
    private TextView MyCollect,MyFollow;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        context=getActivity();
        //动态加载Fragment1的布局文件
        view=inflater.inflate(R.layout.mysavelayout,container,false);
        realName=(TextView)view.findViewById(R.id.tv_realName);
        MyCollect=(TextView)view.findViewById(R.id.tv_mycollect);
        MyFollow=(TextView)view.findViewById(R.id.tv_myfollow);
        if(sessionIDBean.realName.equals("")){
            realName.setText("您注册时未填写真实姓名");
        }else {
            realName.setText("真实姓名：" + sessionIDBean.realName);
        }
        //收藏列表
        MyCollect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(context, MyCollectActivity.class);
                startActivity(intent);
            }
        });
        //关注列表
        MyFollow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(context,MyFollowActivity.class);
                startActivity(intent);
            }
        });
        return view;
    }
}
